package com.zhentao.login.redis;

import org.springframework.data.redis.core.RedisTemplate;

import java.util.concurrent.TimeUnit;

public class RedisTest {
    private RedisTemplate<String,Object> redisTemplate;

    public void setRedisValue(String key,Object value){
        redisTemplate.opsForValue().set(key,value);
    }
    public Object getRedisValue(String key){
        return redisTemplate.opsForValue().get(key);
    }

    public Object removeRedisValue(String key){
        return redisTemplate.delete(key);
    }
    public boolean expire(String key, Long timeOut, TimeUnit timeUnit){
       return redisTemplate.expire(key,timeOut,timeUnit);
    }
}
